package com.ai.service.made.impl;

import com.ai.common.CommonResponse;
import com.ai.entity.made.CoalMaintenanceAlarmRecordInfo;
import com.ai.mapper.made.CoalMaintenanceAlarmRecordInfoMapper;
import com.ai.service.made.ICoalMaintenanceAlarmRecordInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jiaok
 * @since 2024-10-30
 */
@Service
public class CoalMaintenanceAlarmRecordInfoServiceImpl extends ServiceImpl<CoalMaintenanceAlarmRecordInfoMapper, CoalMaintenanceAlarmRecordInfo> implements ICoalMaintenanceAlarmRecordInfoService {

    @Override
    public CommonResponse maintenanceInfo(String maintenanceAlarmRecordId) {


        List<CoalMaintenanceAlarmRecordInfo> alarmRecordInfoList = list(new QueryWrapper<CoalMaintenanceAlarmRecordInfo>()
                .eq("coal_maintenance_id", maintenanceAlarmRecordId).orderByAsc("begin_maintenance_time"));

        return CommonResponse.ok(alarmRecordInfoList);
    }

    @Override
    public String getFinalMaintenanceDate(String id) {
        return  baseMapper.getFinalMaintenceDate(id);
    }
}
